package com.google.code.roztocze358.server;
//package com.google.code.roztocze358.server;

import java.net.*;
import java.io.*;

public class TFERoztoczeProtocol {
    private static final int WAITING = 0;
    private static final int STAN2 = 1;
    private static final int STAN3 = 2;
    private static final int STAN4 = 3;
    private static final int STAN5 = 5;

    private int state = WAITING;
    private int currentStep = 0;

    private String[] clues = { "Turnip", "Little Old Lady", "Atch", "Who", "Who" };
    private String[] answers = { "Turnip the heat, it's cold in here!",
                                 "I didn't know you could yodel!",
                                 "Bless you!",
                                 "Is there an owl in here?",
                                 "Is there an echo in here?" };

    public String processInput(String input) {
        String output = null;

        if (state == WAITING) {
            output = "Odpowiedz";
            state = STAN2;
        }
//        } else if (state == STAN2) {
//            if (input.equalsIgnoreCase("Odpowiedz")) {
//                output = clues[currentStep];
//                state = STAN3;
//            } else {
//                output = "Podpowiedz";
//            }
//        } else if (state == STAN3) {
//            if (input.equalsIgnoreCase(clues[currentStep] + " cosik")) {
//                output = answers[currentStep] + " Blablabla";
//                state = STAN4;
//            } else {
//                output = "cosik2";
//                state = STAN2;
//            }
//        } else if (state == STAN4) {
//            if (input.equalsIgnoreCase("yhy")) {
//                output = "cosik3";
//                if (currentStep == (STAN5 - 1))
//                    currentStep = 0;
//                else
//                    currentStep++;
//                state = STAN2;
//            } else {
//                output = "Sayonara";
//                state = WAITING;
//            }
//        }
        return output;
    }
}
